public class MergeTwoLists {
    public ListNode mergeTwoLists(ListNode l1, ListNode l2) {
        if (null == l2) {
            return l1;
        } 
        if (null == l1) {
            return l2;
        } else {
            ListNode newHead = new ListNode(0);
            ListNode hair = newHead;
            while (l1 != null) {
                if (l2 == null || l1.val <= l2.val) {
                    newHead.next = l1;
                    l1 = l1.next;
                } else if (l1.val > l2.val){
                    newHead.next = l2;
                    l2 = l2.next;
                }
                newHead = newHead.next;
            }
            newHead.next = l2;
            return hair.next;
        }
    }
}